package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.MsgConfigurationMapper;
import com.ruoyi.system.domain.MsgConfiguration;
import com.ruoyi.system.service.IMsgConfigurationService;

/**
 * 消息配置Service业务层处理
 *
 * @author ruoyi
 * @date 2024-04-01
 */
@Service
public class MsgConfigurationServiceImpl implements IMsgConfigurationService
{
    @Autowired
    private MsgConfigurationMapper msgConfigurationMapper;

    /**
     * 查询消息配置
     *
     * @param id 消息配置主键
     * @return 消息配置
     */
    @Override
    public MsgConfiguration selectMsgConfigurationById(Long id)
    {
        return msgConfigurationMapper.selectMsgConfigurationById(id);
    }

    /**
     * 查询消息配置列表
     *
     * @param msgConfiguration 消息配置
     * @return 消息配置
     */
    @Override
    public List<MsgConfiguration> selectMsgConfigurationList(MsgConfiguration msgConfiguration)
    {
        return msgConfigurationMapper.selectMsgConfigurationList(msgConfiguration);
    }

    /**
     * 新增消息配置
     *
     * @param msgConfiguration 消息配置
     * @return 结果
     */
    @Override
    public int insertMsgConfiguration(MsgConfiguration msgConfiguration)
    {
        msgConfiguration.setCreateTime(DateUtils.getNowDate());
        return msgConfigurationMapper.insertMsgConfiguration(msgConfiguration);
    }

    /**
     * 修改消息配置
     *
     * @param msgConfiguration 消息配置
     * @return 结果
     */
    @Override
    public int updateMsgConfiguration(MsgConfiguration msgConfiguration)
    {
        MsgConfiguration msgConfigurationVo = new MsgConfiguration();
        msgConfigurationVo.setId(msgConfiguration.getId());
        msgConfigurationVo.setStatus(msgConfiguration.getStatus());
        msgConfiguration.setUpdateTime(DateUtils.getNowDate());
        return msgConfigurationMapper.updateMsgConfiguration(msgConfiguration);
    }


    /**
     * 删除消息配置信息
     *
     * @param id 消息配置主键
     * @return 结果
     */
    @Override
    public int deleteMsgConfigurationById(Long id)
    {
        return msgConfigurationMapper.deleteMsgConfigurationById(id);
    }
}
